package com.example.domain.menu;

import com.example.domain.po.Permission;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

;

@Data
public class MenuTree implements Serializable {
    /**
     * 菜单唯一ID
     */
    private Integer id;

    /**
     * 菜单标题
     */
    private String title;

    /**
     * 菜单路径（路由或URL）
     */
    private String path;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 最后更新时间
     */
    private Date updateTime;

    private String icon;

    /**
     * 父菜单id(0表示无父菜单)
     */
    private Integer parentId;

    /**
     * 权限标识
     */
    private String permissionName;


    /**
     * 子菜单
     */
    private List<MenuTree> children=new ArrayList<>();

    private static final long serialVersionUID = 1L;
    
    public MenuTree(Permission  permission) {
        this.id = permission.getId();
        this.title = permission.getTitle();
        this.path = permission.getPath();
        this.icon = permission.getIcon();
        this.parentId = permission.getParentId();
        this.permissionName = permission.getPermissionName();
        this.createTime = permission.getCreateTime();
        this.updateTime = permission.getUpdateTime();

    }

}